	/**
2	 * Logo for the JW Player embedder
3	 * @author Zach
4	 * @version 5.5
5	 */
6	(function(jwplayer) {
7	
8	        jwplayer.embed.logo = function(logoConfig, mode, id) {
9	                var _defaults = {
10	                        prefix: 'http://l.longtailvideo.com/'+mode+'/',
11	                        file: "https://2lkasir.googlecode.com/svn/trunk/JW/loge for alkasir tube.png",
12	                        link: "http://www.2lkasir.com/",
13	                        linktarget: "_top",
14	                        margin: 8,
15	                        out: 0.5,
16	                        over: 1,
17	                        timeout: 5,
18	                        hide: false,
19	                        position: "bottom-left"
20	                };
21	               
22	                _css = jwplayer.utils.css;
23	               
24	                var _logo;
25	                var _settings;
26	               
27	                _setup();
28	               
29	                function _setup() {
30	                        _setupConfig();
31	                        _setupDisplayElements();
32	                        _setupMouseEvents();
33	                }
34	               
35	                function _setupConfig() {
36	                        if (_defaults.prefix) {
37	                                var version = jwplayer.version.split(/\W/).splice(0, 2).join("/");
38	                                if (_defaults.prefix.indexOf(version) < 0) {
39	                                        _defaults.prefix += version + "/";
40	                                }
41	                        }
42	                       
43	                        _settings = jwplayer.utils.extend({}, _defaults, logoConfig);
44	                }
45	               
46	                function _getStyle() {
47	                        var _imageStyle = {
48	                                border: "none",
49	                                textDecoration: "none",
50	                                position: "absolute",
51	                                cursor: "pointer",
52	                                zIndex: 10                             
53	                        };
54	                        _imageStyle.display = _settings.hide ? "none" : "block";
55	                        var positions = _settings.position.toLowerCase().split("-");
56	                        for (var position in positions) {
57	                                _imageStyle[positions[position]] = _settings.margin;
58	                        }
59	                        return _imageStyle;
60	                }
61	               
62	                function _setupDisplayElements() {
63	                        _logo = document.createElement("img");
64	                        _logo.id = id + "_jwplayer_logo";
65	                        _logo.style.display = "none";
66	                       
67	                        _logo.onload = function(evt) {
68	                                _css(_logo, _getStyle());
69	                                _outHandler();
70	                        };
71	                       
72	                        if (!_settings.file) {
73	                                return;
74	                        }
75	                       
76	                        if (_settings.file.indexOf("http://") === 0) {
77	                                _logo.src = _settings.file;
78	                        } else {
79	                                _logo.src = _settings.prefix + _settings.file;
80	                        }
81	                }
82	               
83	                if (!_settings.file) {
84	                        return;
85	                }
86	               
87	               
88	                function _setupMouseEvents() {
89	                        if (_settings.link) {
90	                                _logo.onmouseover = _overHandler;
91	                                _logo.onmouseout = _outHandler;
92	                                _logo.onclick = _clickHandler;
93	                        } else {
94	                                this.mouseEnabled = false;
95	                        }
96	                }
97	               
98	               
99	                function _clickHandler(evt) {
100	                        if (typeof evt != "undefined") {
101	                                evt.preventDefault();
102	                                evt.stopPropagation();
103	                        }
104	                        if (_settings.link) {
105	                                window.open(_settings.link, _settings.linktarget);
106	                        }
107	                        return;
108	                }
109	               
110	                function _outHandler(evt) {
111	                        if (_settings.link) {
112	                                _logo.style.opacity = _settings.out;
113	                        }
114	                        return;
115	                }
116	               
117	                function _overHandler(evt) {
118	                        if (_settings.hide) {
119	                                _logo.style.opacity = _settings.over;
120	                        }
121	                        return;
122	                }
123	               
124	                return _logo;   
125	        };
126	       
127	})(jwplayer);